package com.softeem.fx1;

import com.softeem.fx.Stu;
import com.softeem.fx.User;

/**
 * 泛型方法
 * 泛型方法是在方法声明的时候,可以设置参数化类型,然后让方法可以传递任何类型的元素,以及返回任何的类型
 * public [static] <T> 返回值类型 方法名称(参数列表){
 *     ...执行内容
 *     [return 返回值;]
 * }
 * 如果使用void可以省略return不写
 *
 */
public class Demo_02 {
    public static <T> T query(T t,String sql){
        return t;
    }


    public static void main(String[] args) {
        //Demo_02 demo_02 = new Demo_02();
        User user = new User(1,"张甜甜");
        String sql = "select * from user where uname = ?";//你只把它当成字符串来看
        User user1 = Demo_02.query(user,sql);
        System.out.println(user1);


        Stu stu = new Stu(1,"张三");
        String sql1 = "select * from stu where sid = ?";
        Stu stu1 = Demo_02.query(stu,sql1);
        System.out.println(stu1);


    }






}
